package com.itheima.service.impl;

import com.itheima.mapper.EmployeeMapper;
import com.itheima.pojo.Employee;
import com.itheima.pojo.LoginInfo;
import com.itheima.service.EmployeeService;
import com.itheima.util.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * TODO
 *
 * @Author mr.wu
 * @Data #{DATE} #{TIME}
 */
@Service
public class EmployeeServiceImp implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;
    @Override
    public LoginInfo getLogin(Employee employee) {
        LoginInfo loginInfo =  employeeMapper.getLogin(employee);
        String token = JwtUtil.generateToken(loginInfo.getId());
        loginInfo.setToken(token);
        return loginInfo;
    }
}
